<div id="trendsPage">
    <div class="post">
        <h2 class="title">Clients</h2>
        <div class="entry">
            <!--
            <?php
            if ($this->session->userdata("admin")) {
            ?>
                    <input type="button" value="Search" onclick="show('#searchTrends')"/>
                    <input type="button" value="Clear Search" onclick="clearSearch()"/>
            <?php
            }
            ?>
            -->
            <div id="trends_result" class="info">
                <?= $message ?>
            </div>
            <script type="text/javascript">
                function searchTrends(){
                    field=document.getElementById("searchTrendsForm").field.value;
                    search=document.getElementById("searchTrendsForm").search.value;
                    $("#trendsPage").load("<?= base_url(); ?>index.php?/admin_mis/trends/"+field+"/"+search);
                }
                function clearSearch(){
                    $("#trendsPage").load("<?= base_url(); ?>index.php?/admin_mis/trends/");
                }
            </script>

            <div id="searchTrends" style="display: none;margin-bottom: 10px;">
                <form id="searchTrendsForm">
                    <table>
                        <tr class="darker"><td class="half">Select search criteria</td>
                            <td><select name="field">
                                    <option selected="selected" value='added_by'> Added by</option>
                                    <option value='client_name' >Client name</option>
                                    <option value='purpose' >Purpose</option>
                                </select></td>
                            <td><input type="text" name="search" class="wide"  value="<?php echo set_value('added_by'); ?>" /></td>
                        </tr>

                        <tr><td colspan="3" style="text-align: right">
                                <input type="button" value="Submit" onclick="searchTrends()" />
                                <input type="button" value="Cancel" onclick="hide('#searchTrends')"/>
                            </td></tr>

                    </table>
                </form>
            </div>
            <div id="all_trends">
                <?= $tablet ?>
            </div>

        </div>
    </div>